﻿using System;
using System.Collections.Generic;
using System.Text;

namespace 汽车类
{
    //3.设计一个汽车类Vehicle，包含的属性有车轮个数wheels和车重weight。
    //小车类Car是Vehicle的子类，其中包含的属性有载人数loader。
    //卡车类Truck是Car类的子类，其中包含的属性有载重量payload。
    //每个类都有构造方法和输出相关数据的方法。
    class Vehicle
    {
        public int wheels;
        public int Wheels
        {
            get { return wheels; }
            set { wheels = value; }
        }
        public int weight { get; set; }
        public Vehicle()
        {
            this.Wheels = 4;
            this.weight = 20;
        }
        public void xx()
        {
            Console.WriteLine("车轮个数:{0}和车重:{1}", wheels, weight);
        }
    }
    class Car : Vehicle
    {
        public int _loader;
        public int loader
        {
            get { return _loader; }
            set { _loader = value; }
        }
        public Car()
        {
            this.Wheels = 4;
            this.weight = 25;
            this.loader = 8;
        }
        public void xx()
        {
            Console.WriteLine("车轮个数:{0}和车重:{1}载人数:{2}",wheels,weight,_loader);
        }
    }
    class Truck : Car
    {
        public int payload { get; set; }
        public Truck()
        {
            this.Wheels = 8;
            this.weight = 50;
            this.payload = 300;
        }
        public void xx()
        {
            Console.WriteLine("车轮个数:{0}和车重:{1}载重量:{2}", wheels, weight, payload);
        }
    }
}
